function Load_banner()
{
	document.writeln("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='614' height='117'>")
	document.writeln("<param name='movie' value='banner.swf'>")
	document.writeln("<param name='quality' value='high'>")
	document.writeln("<param name='wmode' value='transparent'>")
	document.writeln("<embed src='banner.swf' quality='high' wmode='transparent'  pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='614' height='117'></embed></object>")
}


//document.onselectstart=new Function('return false');
//document.oncontextmenu=new Function("alert('Copyright by Cyclo');return false")
// define a few variables that are required

var vbmenu_usepopups = true;
var ignorequotechars = 0;
// lets define the browser we have instead of multiple calls throughout the file
var userAgent = navigator.userAgent.toLowerCase();
var is_opera  = (userAgent.indexOf('opera') != -1);
var is_saf    = ((userAgent.indexOf('applewebkit') != -1) || (navigator.vendor == "Apple Computer, Inc."));
var is_webtv  = (userAgent.indexOf('webtv') != -1);
var is_ie     = ((userAgent.indexOf('msie') != -1) && (!is_opera) && (!is_saf) && (!is_webtv));
var is_ie4    = ((is_ie) && (userAgent.indexOf("msie 4.") != -1));
var is_moz    = ((navigator.product == 'Gecko') && (!is_saf));
var is_kon    = (userAgent.indexOf('konqueror') != -1);
var is_ns     = ((userAgent.indexOf('compatible') == -1) && (userAgent.indexOf('mozilla') != -1) && (!is_opera) && (!is_webtv) && (!is_saf));
var is_ns4    = ((is_ns) && (parseInt(navigator.appVersion) == 4));

// catch possible bugs with WebTV and other older browsers
var is_regexp = (window.RegExp) ? true : false;


// let's find out what DOM functions we can use
var vbDOMtype = '';
if (document.getElementById)
{
	vbDOMtype = "std";
}
else if (document.all)
{
	vbDOMtype = "ie4";
}
else if (document.layers)
{
	vbDOMtype = "ns4";
}




// function to open a generic window
function openWindow(url, width, height)
{
	var dimensions = "";
	if (width)
	{
		dimensions += ",width=" + width;
	}
	if (height)
	{
		dimensions += ",height=" + height;
	}

	window.open(url, "hf_popup", "statusbar=yes,menubar=no,toolbar=no,scrollbars=yes,resizable=no,left=150,top=150"+ dimensions);
	return false;
}



// function to do a single-line conditional
function iif(condition, trueval, falseval)
{
	return condition ? trueval : falseval;
}


// function to search an array for a value
function in_array(ineedle, haystack, caseinsensitive)
{
	var needle = new String(ineedle);

	if (caseinsensitive)
	{
		needle = needle.toLowerCase();
		for (i in haystack)
		{
			if (haystack[i].toLowerCase() == needle)
			{
				return i;
			}
		}
	}
	else
	{
		for (i in haystack)
		{
			if (haystack[i] == needle)
			{
				return i;
			}
		}
	}
	return -1;
}

function js_toggle_all(formobj, formtype, option, exclude, setto)
{
	for (var i =0; i < formobj.elements.length; i++)
	{
		var elm = formobj.elements[i];
		if (elm.type == formtype && in_array(elm.name, exclude, false) == -1)
		{
			switch (formtype)
			{
				case "radio":
					if (elm.value == option) // option == '' evaluates true when option = 0
					{
						elm.checked = setto;
					}
				break;
				case "select-one":
					elm.selectedIndex = setto;
				break;
				default:
					elm.checked = setto;
				break;
			}
		}
	}
}




// function to register a menu for later initialization
function vbmenu_register(controlid)
{
	if (vbmenu_usepopups)
	{
		vbmenu_doregister(controlid);
	}
}



function js_init()
{
	if (is_webtv)
	{
		return true;
	}
	var imgs = null;
	switch (vbDOMtype)
	{
		case "std": imgs = document.getElementsByTagName("img"); break;
		case "ie4": imgs = document.all.tags("img");             break;
		default:    imgs = false;                                break;
	}
	if (imgs)
	{
		// set 'title' tags for image elements
		for (var i = 0; i < imgs.length; i++)
		{
			if (!imgs[i].title && imgs[i].alt != "")
			{
				imgs[i].title = imgs[i].alt;
			}
		}
	}

	// init registered menus
	if (vbmenu_usepopups && vbmenu_registered.length > 0)
	{
		for (i in vbmenu_registered)
		{
			vbmenu_init(vbmenu_registered[i]);
		}

		// close all menus on mouse click
		document.onclick = vbmenu_close;
	}
	
	hf_a();
	
	return true;
}

function hf_returnObjRef(objName) {

	var objReturn = '';
		if (is_ie || is_ns)
		{
			objReturn = document.getElementById(objName);
			if (!objReturn) {
				objReturn = document.getElementById(hf_findASPNETControl(objName));
			}
		}
		else if (is_ie || is_opera)
		{
			objReturn = document.all[objName];
			if (!objReturn) {
				objReturn = document.all[hf_findASPNETControl(objName)];
			}
		}
		else if (is_ns4)
		{
			objReturn = document.layers[objName];
			if (!objReturn) {
				objReturn = document.layers[hf_findASPNETControl(objName)];
			}
		}

	return objReturn

}

function hf_toggleDisplay(objName)
{

	obj = hf_returnObjRef(objName);
	//img = hf_returnObjRef("hf_obj_Image_" + objName);
	//gft = hf_returnObjRef("hf_obj_Footer_" + objName);
	
	if (obj.style.display == "none")// || gft.style.display == "none")
	{
		obj.style.display = "";
		//gft.style.display = "";
		//img.src = strStylePath + "misc_collapse.gif"
		hf_update_cookie(objName, false);

	}
	else
	{
		obj.style.display = "none";
		//gft.style.display = "none";
		//img.src = strStylePath + "misc_expand.gif"
		hf_update_cookie(objName, true);
	
	}
	return false;
}


function hf_update_cookie(objName, bolSave)
{
	var ckName = "Trieuphu";
	var ckColl = hf_get_cookie(ckName);		
	var arrLocTemp = new Array();
	
	if (ckColl != null) // if cookie exists
	{
		arrColl = ckColl.split(","); // split cookie into array
		
		for (i in arrColl) // loop array
		{
			/* if item does not match objName or is blank */
			if (arrColl[i] != objName && arrColl[i] != "") 
			{
				arrLocTemp[arrLocTemp.length] = arrColl[i];
			}
		}
	}

	if (bolSave) // if item is expanded save groupid to array
	{
		arrLocTemp[arrLocTemp.length] = objName;
	}

	hf_set_cookie(ckName, arrLocTemp.join(",")); // save cookie
}



function hf_set_cookie(name, value)
{
	expire = " expires=Wed, 1 Jan 2020 00:00:00 GMT;";
	document.cookie = name + "=" + value + "; path=/;" + expire;
}



function hf_get_cookie(name)
{
	ckName = name + '=';
	ckPos  = document.cookie.indexOf(ckName);
	
	if ( ckPos != -1 )
	{
		ckStart = ckPos + ckName.length;
		ckEnd   = document.cookie.indexOf(";", ckStart);
		
		if (ckEnd == -1)
		{
			ckEnd = document.cookie.length;
		}
		
		return unescape( document.cookie.substring(ckStart, ckEnd) );
	}
	
	return null;
}



function hf_a()
{
	var ckName = "LMS";
	var ckColl = hf_get_cookie(ckName);		
	var arrLocTemp = new Array();
	
	if (ckColl != null) // if cookie exists
	{
		arrColl = ckColl.split(","); // split cookie into array
		
		if (is_ie || is_opera || is_ns)	
		{
			tbodies = document.getElementsByTagName("tbody");
			for (var i = 0; i < tbodies.length; i++) //loop tag tbody
			{			
				for (var j = 0; j < arrColl.length; j++ ) // loop array cookie
				{
					if (arrColl[j] == tbodies[i].id) 
					{
						tbodies[i].style.display = "none";
					}
				}
			}
		}
	}

}
function hf_find(strObjectName) {	
	var strObjectOutput;		
	tbodies = document.getElementsByTagName("td");	
	for (var i = 0; i < tbodies.length; i++)
	{
		if (tbodies[i].id.indexOf(strObjectName) > 0) {
		strObjectOutput = tbodies[i];
		break;
		}
	}		
	return strObjectOutput;	
}

function hf_findASPNETControl(strObjectName) {	
	var strObjectOutput;		
	tbodies = document.getElementsByTagName("tbody");	
	for (var i = 0; i < tbodies.length; i++)
	{
		if (tbodies[i].id.indexOf(strObjectName) > 0) {
		strObjectOutput = tbodies[i];
		}
	}		
	return strObjectOutput;	
}
function hf_findASPNETSelect(strObjectName) {	
	var strObjectOutput;	
	tbodies = document.getElementsByTagName("select");	
	for (var i = 0; i < tbodies.length; i++)
	{
		if (tbodies[i].id.indexOf(strObjectName) > 0) {			
			strObjectOutput = tbodies[i];
		}
	}	
	return strObjectOutput;	
}
function hf_findASPNETiframe(strObjectName) {	
	var strObjectOutput;	
	tbodies = document.getElementsByTagName("iframe");	
	for (var i = 0; i < tbodies.length; i++)
	{
		if (tbodies[i].id.indexOf(strObjectName) > 0) {			
			strObjectOutput = tbodies[i];
		}
	}	
	return strObjectOutput;	
}
function hf_findASPNETCheckBox(strObjectName) {	
	var strObjectOutput;	
	tbodies = document.getElementsByTagName("input");	
	for (var i = 0; i < tbodies.length; i++)
	{
		if (tbodies[i].id.indexOf(strObjectName) > 0) {
			strObjectOutput = tbodies[i];
		}
	}	
	return strObjectOutput;	
}
function hf_findASPNETTextarea(strObjectName) {	
	var strObjectOutput;	
	tbodies = document.getElementsByTagName("textarea");	
	for (var i = 0; i < tbodies.length; i++)
	{
		if (tbodies[i].id.indexOf(strObjectName) > 0) {
			strObjectOutput = tbodies[i];
		}
	}	
	return strObjectOutput;	
}
function hf_findASPNETTable(strObjectName) {	
	var strObjectOutput;	
	tbodies = document.getElementsByTagName("table");	
	for (var i = 0; i < tbodies.length; i++)
	{
		if (tbodies[i].id.indexOf(strObjectName) > 0) {
			strObjectOutput = tbodies[i];
		}
	}	
	return strObjectOutput;	
}
function hf_findASPNETcell(strObjectName) {	
	var strObjectOutput;	
	tbodies = document.getElementsByTagName("td");	
	for (var i = 0; i < tbodies.length; i++)
	{
			strObjectOutput = tbodies[i];
			strObjectOutput.style.borderColor = "#e0e0e0";		
	}	
	return strObjectOutput;	
}
function hf_findASPNETTextBox(strObjectName) {	
	var strObjectOutput;	
	tbodies = document.getElementsByTagName("input");	
	for (var i = 0; i < tbodies.length; i++){
		if (tbodies[i].id.indexOf(strObjectName) > 0) {
			strObjectOutput = tbodies[i];
			break;
		}
	}	
	return strObjectOutput;	
}
function hf_findASPNETButton(strObjectName) {	
	var strObjectOutput;	
	tbodies = document.getElementsByTagName("input");	
	for (var i = 0; i < tbodies.length; i++)
	{
		if (tbodies[i].id.indexOf(strObjectName) > 0) {
			strObjectOutput = tbodies[i];
		}
	}	
	return strObjectOutput;	
}
function hf_findASPNETImage(strObjectName) {	
	var strObjectOutput;	
	tbodies = document.getElementsByTagName("img");	
	for (var i = 0; i < tbodies.length; i++)
	{
		if (tbodies[i].id.indexOf(strObjectName) > 0) {
			strObjectOutput = tbodies[i];
		}
	}	
	return strObjectOutput;	
}

function hf_findTextBoxHtml(strObjectName) {	
	
	return document.getElementById(strObjectName);
}
//Decription: check valid email address
//@param emailStr(string) : email string input
//@param return(boolean)
function isEmail(emailStr) {
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
	//alert("Email address seems incorrect (check @ and .'s)")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

if (user.match(userPat)==null) {
    //alert("The username doesn't seem to be valid.")
    return false
}

var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        //alert("Destination IP address is invalid!")
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	//alert("The domain name doesn't seem to be valid.")
    return false
}

var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   // the address must end in a two letter or three letter word.
   //alert("The address must end in a three-letter domain, or two letter country.")
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="This address is missing a hostname!"
   //alert(errStr)
   return false
}

// If we've gotten this far, everything's valid!
return true;
}
function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}
function checkNumberpage(s){
		if (s!="")
		{
			var str="0123456789"; 
			for(var j=0;j<str.length;j++)
			if(str.indexOf(s.charAt(j))==-1){								
				return false;
			}		  	
		}
		return true;
	}	
	function checkNumber(s){
		if (s!="")
		{
			var str=".,0123456789"; 
			for(var j=0;j<str.length;j++)
			if(str.indexOf(s.charAt(j))==-1){								
				return false;
			}		  	
		}
		return true;
	}	
//-------------------------------------------------------------------
function getURLParam(strParamName)
{
	var strReturn = "";
	var strHref = window.location.href;
	if ( strHref.indexOf("?") > -1 )
	{
		var strQueryString = strHref.substr(strHref.indexOf("?"));
		var aQueryString = strQueryString.split('&');
		for ( var iParam = 0 ;iParam < aQueryString.length ;iParam++ )
		{
		    var str=aQueryString[iParam];		    
		    str=str.replace("?","");		  
			if ( str.indexOf(strParamName + "=")== 0 )
			{
				var aParam = aQueryString[iParam].split("=");
				strReturn = aParam[1];
				break;
			}
		}
	}
return strReturn;
}
function OpenWindow(theURL)
 { 
	var winName="PopUp";
	var features="toolbar=no,location=no,status=yes,scrollbars=no,width=700,height=600top=150,left=150"
  window.open(theURL,winName,features);
}

function FromTextArea(str)
{
	while(str.indexOf("\n")!=-1)
	{
		str=str.replace("\n","<br>");
	}
	
	return str;
}
function ToTextArea(str)
{
	while(str.indexOf("<br>")!=-1)
	{
		str=str.replace("<br>","\n");
	}
	
	return str;
}

//popup picture
var CPW_md = false;
	var CPW_sel, CPW_oX, CPW_oY;
	function Pop_mMove() {
		if(CPW_md && CPW_sel) {
			CPW_sel.pixelLeft = window.event.clientX - CPW_oX;
			CPW_sel.pixelTop = window.event.clientY - CPW_oY;}}
	function Pop_mDown() {
		CPW_md = true;
		if(CPW_sel) {
			CPW_sel.zIndex = 0;
			CPW_sel = null;}
		CPW_sel = document.getElementById("Picture_window").style;
		CPW_sel ? CPW_sel.zIndex = 9 : CPW_sel = null;
		evt = window.event;
		CPW_oX = evt.offsetX - ((evt.offsetX < -2) ? 0 : document.body.scrollLeft);
		CPW_oX -= (document.body.parentElement && document.body.parentElement.scrollLeft) ? document.body.parentElement.scrollLeft : 0;
		CPW_oY = evt.offsetY - ((evt.offsetY < -2) ? 0 : document.body.scrollTop);
		CPW_oY -= (document.body.parentElement && document.body.parentElement.scrollTop) ? document.body.parentElement.scrollTop : 0;
		var oPar = window.event.srcElement;
		while(oPar && oPar != CPW_sel) {
			CPW_oX += oPar.offsetLeft;
			CPW_oY += oPar.offsetTop;
			oPar = oPar.offsetParent;}
		return false;}
	function Pop_mUp() {
		CPW_md = false;}
	function Pop_ShowWindow(strImage){
		var CPW_show = document.getElementById("Picture_window").style;
		if(CPW_show){
			if(CPW_show.visibility=='visible') {Pop_HideWindow();}
				CPW_show.left="-100000px";
				CPW_show.top="-100000px";				
				document.getElementById("Picture").src=strImage;				
				CPW_show.visibility='visible';}}
	function Pop_HideWindow(){
		var CPW_show = document.getElementById("Picture_window").style;
		if(CPW_show){CPW_show.visibility='hidden';}}
	function ResizePic(){		
		var CPW_show = document.getElementById("Picture_window");
		var CPW_pic = document.getElementById("Picture");
		var o_W = (CPW_show.clientWidth==0) ? (CPW_pic.width+10) : (CPW_show.clientWidth);
		var o_H = (CPW_show.clientHeight==0) ? (CPW_pic.height+30) : (CPW_show.clientHeight);
		CPW_show.style.left=(document.body.scrollLeft+parseInt((document.body.clientWidth-o_W)/2))+"px";
		CPW_show.style.top=(document.body.scrollTop+parseInt((document.body.clientHeight-o_H)/2))+"px";
	}
/// For Menu

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; 
  document.MM_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null)
   {
	document.MM_sr[j++]=x; 
		if(!x.oSrc) 
		x.oSrc=x.src; 
		x.src=a[i+2];
	}
}
//phu

  function setOpacity(obj, opacity)
 {
 opacity = (opacity == 100)?99.999:opacity;
 opacity = (opacity < 0)?0:opacity;

 // IE/Win
 obj.style.filter = "alpha(opacity:"+opacity+")";

 // Safari<1.2, Konqueror
 obj.style.KHTMLOpacity = opacity/100;

 // Older Mozilla and Firefox
 obj.style.MozOpacity = opacity/100;

 // Safari 1.2, newer Firefox and Mozilla, CSS3
 obj.style.opacity = opacity/100;
 }
 

function submitbuttonasp(e,strbutton)
{
	
//Only Netscape 4 and Escape 4 need this first line
    if( document.captureEvents && Event.KEYUP )         
    {
			ch = e.which || e.keyCode;
            //document.captureEvents( Event.KEYUP ); 
            if(ch==13)
            { 
				ob = hf_findASPNETTextBox(strbutton);
				ob.focus(); 
				ob.click();
				return false;		
            }
    
    }
//Only IE 4 
    if(event.keyCode==13)
    {
    	ob = hf_findASPNETTextBox(strbutton);
		ob.focus(); 
		ob.click();	
        return false;		
   }   
   return true;	   
}